﻿using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using Sharp.Platform.Configuration;

namespace Sharp.WebBooter.Areas.CMS
{
    /// <summary>
    /// 系统信息设置
    /// </summary>
    [DisplayName("CMS信息设置")]
    public class CMSInfoConfig : ISystemConfig
    {
        /// <summary>
        /// 平台的系统级
        /// </summary>
        public CMSInfoConfig()
        {
            LogoUrl = "/Content/Images/Example/logo2.png";
            SerivceUrl = "http://localhost:8555/";
            EMailConfig = new EMailParam();
        }


        public string SysName => "演示站点";

        /// <summary>
        /// 简介
        /// </summary>
        public string Description { get; set; }
        /// <summary>
        /// 通讯地址
        /// </summary>
        public string Address { get; set; }
        /// <summary>
        /// 网址
        /// </summary>
        [Display(Name = "网址")]
        [RegularExpression(@"^http[s]{0,1}://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$", ErrorMessage = "网址 格式不正确")]
        public string WebSite { get; set; }

        /// <summary>
        /// 官方微博
        /// </summary>
        public string Blog { get; set; }
        /// <summary>
        /// 官方微信
        /// </summary>
        public string WeChat { get; set; }
        /// <summary>
        /// 官方邮箱
        /// </summary>
        [Display(Name = "官方邮箱")]
        [RegularExpression(@"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "官方邮箱 格式不正确")]
        public string Email { get; set; }
        /// <summary>
        /// Logo图片
        /// </summary>
        public string LogoUrl { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remarks { get; set; }

        /// <summary>
        /// 服务端基本地址
        /// </summary>
        public string SerivceUrl { get; set; }

        public EMailParam EMailConfig { get; set; }
        /// <summary>
        /// 配置文件的文件名
        /// </summary>
        public string ConfigFileName => "CMS信息设置.Config";
        /// <summary>
        /// 开发商
        /// </summary>
        public string Developer => "www.PlatformSharp.com";

        /// <summary>
        /// 电邮配置
        /// </summary>
        public class EMailParam
        {
            public EMailParam()
            {
                FromEMail = "ak47@163.com";
                LoginName = "ak47@163.com";
                Password = "ak47";
                SmtpServer = "smtp.163.com";
            }
            /// <summary>
            /// 发送人邮箱
            /// </summary>
            public string FromEMail { get; set; }
            /// <summary>
            /// 邮件登录名
            /// </summary>
            public string LoginName { get; set; }
            /// <summary>
            /// 邮件登录密码
            /// </summary>
            public string Password { get; set; }
            /// <summary>
            /// 服务器smtp
            /// </summary>
            public string SmtpServer { get; set; }
        }
    }
}